<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>miniFOC: algorithm/encoder.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectlogo"><img alt="Logo" src="Acme_LOGO.png"/></td>
  <td id="projectalign">
   <div id="projectname">miniFOC<span id="projectnumber">&#160;1.0.3</span>
   </div>
   <div id="projectbrief">This open-source project aims to accomplish a FOC(Field Oriented Control) scheme that is operatable with minimum costs in China.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_99d3723365464dd656f512988bb8dbbd.html">algorithm</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">encoder.h</div></div>
</div><!--header-->
<div class="contents">
<a href="encoder_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span><span class="comment">/**************************************************************************/</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span><span class="preprocessor">#ifndef MINIFOC_ALGORITHM_ENCODER_H_</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="preprocessor">#define MINIFOC_ALGORITHM_ENCODER_H_</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span> </div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span><span class="keyword">extern</span> <span class="keyword">volatile</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code hl_variable" href="encoder_8h.html#a562eacc7259f25574b1ab8ce9d7c6a3e">machine_angle_offset</a>;</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno">   13</span><span class="keywordtype">void</span> <a class="code hl_function" href="encoder_8h.html#ad28e37c20d065e5014ea3a5f2de91e82">encoder_zeroing</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno">   14</span><span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code hl_function" href="encoder_8h.html#a28beb7b571ff9e6d39118c8d1324e154">encoder_get_mechanical_angle</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno">   15</span><span class="keywordtype">float</span> <a class="code hl_function" href="encoder_8h.html#a8fbcb19c2f15c20c1a862e0cf64f6771">encoder_get_electronic_angle</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno">   16</span><span class="keywordtype">void</span> <a class="code hl_function" href="encoder_8h.html#a82c51d78a1f7bb4a5976974ab8d7ffe5">encoder_update_speed</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno">   17</span> </div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno">   18</span><span class="preprocessor">#endif </span><span class="comment">//MINIFOC_ALGORITHM_ENCODER_H_</span></div>
<div class="ttc" id="aencoder_8h_html_a28beb7b571ff9e6d39118c8d1324e154"><div class="ttname"><a href="encoder_8h.html#a28beb7b571ff9e6d39118c8d1324e154">encoder_get_mechanical_angle</a></div><div class="ttdeci">unsigned short encoder_get_mechanical_angle(void)</div><div class="ttdoc">read mechanical angle directly from encoder</div><div class="ttdef"><b>Definition:</b> <a href="encoder_8c_source.html#l00076">encoder.c:76</a></div></div>
<div class="ttc" id="aencoder_8h_html_a562eacc7259f25574b1ab8ce9d7c6a3e"><div class="ttname"><a href="encoder_8h.html#a562eacc7259f25574b1ab8ce9d7c6a3e">machine_angle_offset</a></div><div class="ttdeci">volatile unsigned short machine_angle_offset</div><div class="ttdoc">mechanical angle offset, which is used to align the mechanical angle with the zero point of the elect...</div><div class="ttdef"><b>Definition:</b> <a href="encoder_8c_source.html#l00023">encoder.c:23</a></div></div>
<div class="ttc" id="aencoder_8h_html_a82c51d78a1f7bb4a5976974ab8d7ffe5"><div class="ttname"><a href="encoder_8h.html#a82c51d78a1f7bb4a5976974ab8d7ffe5">encoder_update_speed</a></div><div class="ttdeci">void encoder_update_speed(void)</div><div class="ttdoc">called every 2 milliseconds to calculate the speed.</div><div class="ttdef"><b>Definition:</b> <a href="encoder_8c_source.html#l00106">encoder.c:106</a></div></div>
<div class="ttc" id="aencoder_8h_html_a8fbcb19c2f15c20c1a862e0cf64f6771"><div class="ttname"><a href="encoder_8h.html#a8fbcb19c2f15c20c1a862e0cf64f6771">encoder_get_electronic_angle</a></div><div class="ttdeci">float encoder_get_electronic_angle(void)</div><div class="ttdoc">according to the electrical angle calculated from the mechanical angle, this function will call encod...</div><div class="ttdef"><b>Definition:</b> <a href="encoder_8c_source.html#l00093">encoder.c:93</a></div></div>
<div class="ttc" id="aencoder_8h_html_ad28e37c20d065e5014ea3a5f2de91e82"><div class="ttname"><a href="encoder_8h.html#ad28e37c20d065e5014ea3a5f2de91e82">encoder_zeroing</a></div><div class="ttdeci">void encoder_zeroing(void)</div><div class="ttdoc">correct the mechanical angle zero deviation between the magnetic encoder and FOC.</div><div class="ttdef"><b>Definition:</b> <a href="encoder_8c_source.html#l00119">encoder.c:119</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
